<template>
  <div class="panel">
    <div class="pic" :style="{ color: props.color }">
      <div class="iconWrap">
        <slot></slot>
      </div>
    </div>
    <div class="right">
      <h3 class="title">{{ props.title }}</h3>
      <!-- <span class="count">{{ props.num }}</span> -->
      <count-up class="count" :end-val="props.num"></count-up>
    </div>
  </div>
</template>
<script setup>
import { AppstoreFilled } from "@ant-design/icons-vue";
import * as aa from "@ant-design/icons-vue";
console.log(aa);
import CountUp from "vue-countup-v3";
// 接受父组件的值：defineProps
const props = defineProps({
  color: {
    type: String,
    default: "#f00",
  },
  title: {
    type: String,
    default: "标题",
  },
  num: {
    type: Number,
    default: 0,
  },
});
console.log(props);
</script>
<style scoped lang="less">
.panel {
  display: flex;
  justify-content: space-between;
  background-color: #fff;
  padding: 20px 10px;
  cursor: pointer;
  &:hover {
    .pic {
      background-color: currentColor;
    }
    .iconWrap {
      color: #fff;
    }
  }
  .pic {
    padding: 10px;
    border-radius: 5px;
    width: 60px;
    height: 60px;
    transition: all 0.3s;
  }
  .right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    h3 {
      line-height: 26px;
      font-size: 16px;
      color: #999;
    }
    .count {
      font-size: 20px;
      font-weight: bold;
      color: #999;
    }
  }
}
</style>
